package com.example.demo.time;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class TransTime {
    public static void main(String[] args) throws ParseException {
        /*Date date = new Date();
        System.out.println("20220314T16:00:00.000Z");
        System.out.println(date);*/

        String date = "2023-02-28T16:00:00.000Z";
        date = date.replace("-", "");
        String substring = date.substring(0, 8);
        System.out.println(substring);

        System.out.println(date);
        SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd'T'HH:mm:ss.SSS Z");
        Date d = format.parse(date);
        System.out.println(d);

        /*String date = "2019-03-09T16:00:00.000Z";
        date = date.replace("Z", " UTC");
        System.out.println(date);
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS Z");
        Date d = format.parse(date);
        System.out.println(d);*/
    }
}
